package net.sk.china.platform.service.system;

import com.baomidou.mybatisplus.extension.service.IService;
import net.sk.china.common.model.system.SystemConfig;
import net.sk.china.platform.request.system.SystemConfigAdminRequest;
import net.sk.china.platform.request.system.SystemFormCheckRequest;
import net.sk.china.platform.response.order.ExpressSheetResponse;

import java.util.HashMap;
import java.util.List;

/**
 * SystemConfigService 接口
 * +----------------------------------------------------------------------
 * // | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * // +----------------------------------------------------------------------
 * // | Copyright (c) 2018-2024 聊来 All rights reserved.
 * // +----------------------------------------------------------------------
 * // | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * // +----------------------------------------------------------------------
 * // | @Author: 聊来 <18970881148@qq.com>
 * // +----------------------------------------------------------------------
 * // | DateTime: 2024/6/3 10:22
 * // +----------------------------------------------------------------------
 */

public interface SystemConfigService extends IService<SystemConfig> {

    /**
     * 根据menu name 获取 value
     * @param name menu
     * @return {@code String}
     */
    String getValueByKey(String name);

    /**
     * 根据menu name 获取 value
     * @param name menu
     * @param cache true: 读取缓存 false: 不读取缓存
     * @return {@code String}
     */
    String getValueByKey(String name, Boolean cache);

    /**
     * 根据menu name 获取 value
     * @param name menu
     * @return {@code long}
     */
    long getLongValueByKey(String name);

    /**
     * 根据 name 获取 value 找不到抛异常
     * @param name menu
     * @return {@code String}
     */
    String getValueByKeyException(String name);


    /**
     * 根据formId查询数据
     * @param formId Integer id
     * @return {@code HashMap<String, String>}
     */
    HashMap<String, String> info(Integer formId);

    /**
     * 整体保存表单数据
     * @param systemFormCheckRequest SystemFormCheckRequest 数据保存
     * @return {@code boolean}
     */
    boolean saveForm(SystemFormCheckRequest systemFormCheckRequest);

    /**
     * 根据name查询数据
     * @param name name
     * @return {@code boolean}
     */
    boolean checkName(String name);

    /**
     * 保存或更新配置数据
     * @param name 菜单名称
     * @param value 菜单值
     * @return {@code boolean}
     */
    boolean updateOrSaveValueByName(String name, String value);

    /**
     * 根据key获取配置
     * @param key key
     * @return {@code List<SystemConfig>}
     */
    List<SystemConfig> getListByKey(String key);

    /**
     * 更新配置信息
     * @param requestList 请求数组
     * @return {@code boolean}
     */
    boolean updateByList(List<SystemConfigAdminRequest> requestList);

    /**
     * 获取面单默认配置信息
     * @return {@code ExpressSheetResponse}
     */
    ExpressSheetResponse getDeliveryInfo();
}
